Operators
Advanced Authoring - GPRM Operators We have already shown some examples of operators that can be used with GPRM registers. Most notably you may recognize the obvious GPRM1 = 15 from previous pages. This is one of the many operators and it is called simply Assign operator. On the previous page you may also have read about Syntax normalization and that DVD-lab VM editor is quite open minded to various syntaxes, however it will always change the command into its native syntax Operator Name DVD-lab Syntax Example Alternative syntax Meaning Assign GPRM1 = 15 GPRM1 = GPRM2 GPRM1 = SPRM1 mov GPRM1, 15 GPRM1 mov 15 MOV(GPRM1, 15) Assign value or value from register to another register Swap GPRM1 <-> GPRM2 swp GPRM1, GPRM2 GPRM1 swp GPRM2 SWP(GPRM1,15) Swap the two registers Addition GPRM1 += 15 GPRM1 += GPRM2 add GPRM1, 15 GPRM1 add 15 ADD(GPRM1,15) GPRM1 = GPRM1 + 15 Subtraction GPRM1 -= 15 GPRM1 -= GPRM2 sub GPRM1, 15 GPRM1 sub 15 SUB(GPRM1,15) GPRM1 = GPRM1 - 15 Multiply GPRM1 *= 15 GPRM1 *= GPRM2 mul GPRM1, 15 GPRM1 mul 15 MUL(GPRM1,15) GPRM1 = GPRM1 * 15 Divide GPRM1 /= 15 GPRM1 /= GPRM2 div GPRM1, 15 GPRM1 div 15 DIV(GPRM1,15) GPRM1 = GPRM1 / 15 Remainder GPRM1 %= 15 GPRM1 %= GPRM2 mod GPRM1, 15 GPRM1 mod 15 MOD(GPRM1,15) Remainder or modulo after division GPRM1 = GPRM1 % 15 Random GPRM1 rnd 15 GPRM1 rnd GPRM2 rnd GPRM1, 15 RND(GPRM1,15) Random value between 0-15 AND GPRM1 &= 15 GPRM1 &= GPRM2 and GPRM1, 15 GPRM1 and 15 AND(GPRM1,15) Logical AND OR GPRM1 |= 15 GPRM1 |= GPRM2 or GPRM1, 15 GPRM1 or 15 OR(GPRM1,15) Logical OR XOR GPRM1 ^= 15 GPRM1 ^= GPRM2 xor GPRM1, 15 GPRM1 xor 15 XOR(GPRM1,15) Logical XOR From the above table it is clear that the left side of an operator can only be a GPRM register. The right side of an operator can be another GPRM register, SPRM register or constant. If Condition To check the condition of GPRM registers there is a command if (.....) ..... Example used previously: if (GPRM1 2 ) LinkPGCN 4 But there are more operands than just Operator DVD-lab Syntax Example Meaning if (GPRM1 15) if (GPRM1 GPRM2) if (GPRM1 SPRM2) if GPRM is equal (make sure you type two equal signs ) != if (GPRM1 != 15) if (GPRM1 != GPRM2) if (GPRM1 != SPRM2) if GPRM is not equal >= if (GPRM1 >= 15) if (GPRM1 >= GPRM2) if (GPRM1 >= SPRM2) if GPRM is greater or equal > if (GPRM1 > 15) if (GPRM1 > GPRM2) if (GPRM1 > SPRM2) if GPRM is greater <= if (GPRM1 <= 15) if (GPRM1 <= GPRM2) if (GPRM1 <= SPRM2) if GPRM is less or equal < if (GPRM1 < 15) if (GPRM1 < GPRM2) if (GPRM1 < SPRM2) if GPRM is less & if (GPRM1 & 15) if (GPRM1 & GPRM2) if (GPRM1 & SPRM2) if logical and is not zero From the above table it is clear that the left side of an operator can only be a GPRM register. The right side of an operator can be another GPRM register, SPRM register or a constant. Almost all other commands can be used with comparison (there are some exceptions), however you can not always compare GPRM to a constant value. For example: if (GPRM1 2) LinkPGCN 1 is valid, but if (GPRM1 2) JumpSS VMGM 1 is not valid. You have to use two lines GPRM2 = 2 if (GPRM1 GPRM2) JumpSS VMGM 1 Generally JumpSS type, CallSS type and Set type (SetHL_BTN for example) can't be used together in comparison with a constant. Combination Condition commands Because some places on a DVD allow only one line of commands (most notably for button and cell commands), the DVD specs allow for special combination commands. What this means is, they can have up to 3 commands on one line where one is a condition, the second is an operator and the last is a link. There are also three different ways to put them together. Note how the curly parenthesis differ on the first two lines: if (GPRM1 GPRM2) { GPRM1 = 5 } LinkTopC (button 1) if (GPRM1 GPRM2) { GPRM1 = 5, LinkTopC (button 1) } GPRM1 = 5, if (GPRM1 GPRM2) LinkTopC (button 1) The first is Condition then {operator} if condition is true and then link regardless the condition Second is Condition then {operator and link} if condition is true Third is operator, then condition and link if condition is true. Unfortunately not all link commands can be used in this combo. Only link types of: LinkNoLink, LinkTopC,....,LinkTopPG, .....LinkTopPGC, .... LinkTailPGC It is not very probable you would need to use this type of command. Set combination commands A few Set commands are allowed in combination with a Link (except in combination with a condition). These are useful for places such as Button in a menu. SetHL_BTN GPRM1, LinkPGCN 1 Sets the highlighting register to value in GPRM1 and then Link to PGC 1 SetSTN (audio=1 subp=2:on angle=3 ) LinkPGCN 2 Set Audio/Subpicture/Angle Stream and then link to PGC 2. This can be used for example on menu to select subtitles and then immediately link to a different menu where the subtitles text is shown as selected.